#include "SelectorImpl.h"

ElementSelectorImpl::ElementSelectorImpl()
{

}

ElementSelectorImpl::ElementSelectorImpl(const string& alocalName)
	:localName(alocalName)
{

}

ElementSelectorImpl::~ElementSelectorImpl()
{

}

Selector* ElementSelectorImpl::Copy()const
{
	return new ElementSelectorImpl(localName);
}

Selector::SelectorType ElementSelectorImpl::getSelectorType()const
{
	return Selector::SAC_ELEMENT_NODE_SELECTOR;
}

const string* ElementSelectorImpl::toString()const
{

	string* result = NULL;
	try
	{
		result = new string();
		if(localName.empty())
			*result = "*";
		else
			*result = localName;
	}catch(std::exception& e)
	{
		if(result)
			delete result;
		return NULL;
	}
	return result;
}

const string* ElementSelectorImpl::getNamespaceURI()const
{
	return NULL;
}

const string* ElementSelectorImpl::getLocalName()const
{
	if(localName.empty())
		return NULL;
	return &localName;
}
